package com.fannm.controller.jpaStudy;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fannm.model.Emp;
import com.fannm.service.EmpService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "测试")
@RestController
public class HelloController {
	@Autowired
	private EmpService empService;

	@ApiOperation(value = "测试hibernate")
	@GetMapping("/query")
	public List<Emp> queryEmpAll() {
		empService.save(new Emp("test", "1"));
		List<Emp> empList = empService.queryEmpAll();
		for (Emp emp : empList) {
			System.out.println("name : " + emp.getEname());
		}
		return empList;
	}
}